﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using UnliQ.Core;
using UnliQ.Data;

namespace UnliQ.Service
{
    public class UnliQContext
    {
        private UnliQContext() { }

        #region Private Members
        private static UnliQContext _currentContext = null;
        private static object _contextLock = new object();

        private IQueueRepo _queueRepo = null;

        #endregion


        public static UnliQContext Current
        {
            get
            {
                lock (_contextLock)
                {
                    if (_currentContext == null) _currentContext = new UnliQContext();
                }
                return _currentContext;
            }
        }

        public IQueueRepo QueueRepo 
        { 
            get 
            {
                if (_queueRepo == null)
                    _queueRepo = ProviderFactory.CreateProvider<IQueueRepo>();
                return _queueRepo;
            } 
        
        }
    }
}
